Wind turbines are provided with an orientation system around a vertical axis, which allows the nacelle to be aligned in the wind direction so as to maximise the harvesting of energy from the wind. This mechanism, called the yaw system is commanded by a wind vane located on the roof of the nacelle downwind of the rotor.
There are different factors that can introduce an error in the alignment of the nacelle, among them:                distortion of the flow in the wind vane induced by the rotor;        errors in the assembly of the wind vane.        
An error in the alignment of the nacelle in relation to the wind direction entails a loss of energy production and an increase in loads on the wind turbine, which are greater, the greater misalignment.
With the goal to minimising the effect of some of the factors that affect orientation, it is usual to introduce a parameter called the yaw offset which is added to the signal provided by the wind vane.
As a first approach, it is considered the value of this parameter to be a constant and apply equally to all the wind turbines belonging to the same family.
It is known in the state of the art patent document EP1809899B1 relating to a method for the automatic correction of control parameters for the orientation of a wind turbine, which comprises the following steps:                a step of measurement of the speed and wind direction, in addition to measurement of an electromagnetic property,        a step of obtainment of an efficiency measurement based on the measurement of the electromagnetic property and wind speed, this efficiency measurement being an indicator of how much the wind turbine generates in given conditions,        a step of classification into positive and negative wind direction to obtain a first mean value of the efficiency measurement for which the wind direction is positive and to obtain a second mean value of the efficiency measurement for which the wind direction is negative,        a step of determination of the difference between the first and second mean efficiency value, and        a step of issuance to the control system in charge of the orientation of a calibration value corresponding to the difference.        
This method indicates that there may be a position error and issues a correction value. However, due to the way of obtaining it, based solely on the difference between the efficiency values, it provides a not very accurate value and is very sensitive to the uncertainties associated with measurements.
Patent document U.S. Pat. No. 8,476,780 is also known, relating to a method for estimating the wind direction in a wind turbine which comprises the following steps:                a step of detection of a main wind direction,        a step of assuming an actual wind direction by assuming an offset value which is a deviation between the main wind direction and the actual wind direction, at a predetermined wind speed,        a step of calculating an average generator output power for a predetermined period of time in the actual wind direction which has been assumed,        a step of estimating the actual wind direction by approximating the average generator output power with respect to the wind direction offset value which has been assumed to a quadratic curve and estimating the wind direction offset value at the time when the average generator output power is the maximum in the quadratic curve which has been approximated to be an actual offset value.        
However, this solution is not very robust and is very sensitive to errors or uncertainties associated with measurements for the following reasons:
Said method carries out the calculation of the correction value in real time, detecting the main wind direction and assuming offset values (−10°, 0° and 10° in the example) to calculate corresponding wind directions according to said offset values. As a consequence of assuming these offset values, misalignments are being forced in the wind turbine. This has the drawback of production losses and increase in loads on the wind turbine due to the fact that a specific campaign has to be carried out in order to force said misalignments.
Subsequently, it approximates the points by least squares fit .Ito a quadratic function, calculating the maximum thereof and determining the correction value on the basis of said maximum. This quadratic regression presents the following drawbacks:                On performing the quadratic regression, it is possible that depending on the values obtained, the quadratic function or parabola does not have a maximum, meaning that the step of estimation of the method above would have as a result an error value. This situation is due to the fact that owing to uncertainties in the measurement, the points are not exactly in their theoretical position but rather may have variations around that position. These variations, although of a small magnitude, may distort the results and even generate an error in the estimation.        On performing the quadratic regression, it can be that, depending on the values obtained, the quadratic function or parabola does have a maximum, but it may be distant from the real wind direction, meaning that the correction value would be very high, close to 90°, which is very probably not the correct correction value.        
The object of the present invention is a control method to detect situations in which the wind turbine is not working at its optimal operating point due to a misalignment of said wind turbine with respect to the wind direction, overcoming the aforementioned drawbacks in the state of the art.
Also, once these situations have been detected, the control method of the present invention makes it possible to carry out an automatic correction of the control parameters and to return the wind turbine to its optimal operating point.